package com.jie.deletefile.CardView;

import android.annotation.TargetApi;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.CardView;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.TextView;

import com.jie.deletefile.R;

public class CardViewActivity extends AppCompatActivity  {

    private ImageView card_iv;
    private TextView card_tv;
    private CardView card;
    private SeekBar yuan_sb;
    private SeekBar yin_sb;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_card_view);
        initView();
    }

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    private void initView() {
        card_iv = (ImageView) findViewById(R.id.card_iv);
        card_tv = (TextView) findViewById(R.id.card_tv);
        card = (CardView) findViewById(R.id.card);
        yuan_sb = (SeekBar) findViewById(R.id.yuan_sb);
        yin_sb = (SeekBar) findViewById(R.id.yin_sb);
//        yin_sb.setProgress((int) card.getElevation());
        yuan_sb.setProgress((int) card.getRadius());

        yuan_sb.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                card.setRadius(progress);
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {

            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {

            }
        });

        yin_sb.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                card.setCardElevation(progress);
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {

            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {

            }
        });
    }
}
